namespace Nua.Compiler
{
	// A position in the source text. Created by the scanner and threaded
	// through to other data structures. Used for reporting errors with file
	// names and line numbers. Rows and columns are counted from one (not
	// zero.)
	public struct Position
	{
		internal readonly string FileName;
		public readonly int Row;
		public readonly int Column;

		// Creates a position with the specified file name, row and column
		public Position(string fileName, int row, int column)
		{
			this.FileName = fileName;
			this.Row = row;
			this.Column = column;
		}

        public Position(int index)
        {
            this.FileName = "";
            this.Row = 0;
            this.Column = 0;
        }

		// A string representation suitable for error reporting
		public override string ToString()
		{
			return string.Format("{0}({1},{2})", this.FileName, this.Row, this.Column);
		}

	}
}
